<%--
  Created by IntelliJ IDEA.
  User: TLY
  Date: 2022/12/8
  Time: 11:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="./common/taglibs.jsp"%>
${jquery_js}
${validate_jquery_js}
${form_jquery_js}

<html>
<head>

    <title>理发店业务管理系统</title>
    <link type="text/css" rel="stylesheet" href="${ctx}/css/style.css" />
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
</head>
<body>
<div id="header" class="wrap">

    <div class="navbar">
        <ul class="clearfix">
            <ul class="clearfix">
                <li><a href="${ctx}/index.jsp">首页</a></li>
                <li><a href="${ctx}/user/getpageusers">会员管理</a></li>
                <li><a href="${ctx}/staff/getstaffs">职工管理</a></li>
                <li class="current"><a href="${ctx}/order/getorders">订单管理</a></li>
            </ul>
        </ul>
    </div>
</div>
<div id="childNav">
    <div class="welcome wrap">
        管理员${admin.name}您好，欢迎回到管理后台。
    </div>
</div>

<div id="main" class="wrap">
    <div id="menu-mng" class="lefter">
        <div class="box">
            <dl>
       <%--         <dt><a href="${ctx}/user/getpageusers">会员管理</a></dt>
                <dd><em></em><a href="${ctx}/useradd.jsp">新增会员</a></dd>
                <dd><em></em><a href="${ctx}/topUp.jsp">会员充值</a></dd>
                <dt>职工管理</dt>
                <dd><em></em><a href="${ctx}/addstaff.jsp">新增职工</a></dd>--%>
                <dt>订单管理</dt>
                <dd><em></em><a href="${ctx}/order/addorder">新增订单</a></dd>
            </dl>
        </div>
    </div>
    <div class="main">
        <h2>订单管理</h2>
        <div class="manage">
            <div class="search">
            </div>
            <div class="spacer"></div>
            <form id="myform" action="${ctx}/order/getorders" method="post">

                订单id：<input type="text" name="orderid" maxlength="5">
                会员姓名：<input type="text" name="user.username" maxlength="10">
                服务项目：<input type="text" name="skillname" maxlength="10">
                <label class="ui-blue"><input type="submit"  id="subsearch" value="查询" /></label>

            </form>
            <table class="list">

                <c:forEach items="${orders}" var="i">

                    <tr>
                        <th>单号：${i.orderid}</th>
                        <th colspan="2"> 消费会员：${i.user.username}</th>
                        <th >状态:

                             <c:if test="${i.ispayment==1}">已付款</c:if>
                         <c:if test="${i.ispayment==0}">未付款</c:if>



                        </th>
                        <th colspan="2" > 操作</th>
                    </tr>

                    <tr  class="mytr">
                        <td class="first w4 c"><img src="" />职工</td>
                        <td >消费服务</td>
                        <td colspan="">单价</td>
                        <td colspan="3">下单时间：<fmt:formatDate value="${i.createtime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>


                    </tr>


                    <c:forEach items="${i.orderdetails}" var="o" end="0" >
                        <tr>
                            <td class="first w4 c"><img src="" />${o.staff.staffname}</td>
                            <td >${o.skill.skillname}</td>
                            <td>${o.skill.price}</td>
                            <td colspan="2" class="w1 c" rowspan="${fn:length(i.orderdetails)}">总计：${i.cost}</td>
                            <td  class="w1 c" rowspan="${fn:length(i.orderdetails)}">
                                <a href="${ctx}/order/updateorder/${i.orderid}">修改</a> <a class="mymanageDel" id="del" href="javascript:void(0)" rel="${i.orderid}">删除</a>
                            </td>

                        </tr>
                    </c:forEach>

                    <c:forEach items="${i.orderdetails}" var="o"  begin="1"  >
                        <tr>
                            <td class="first w4 c"><img src="" />${o.staff.staffname}</td>
                            <td >${o.skill.skillname}</td>
                            <td>${o.skill.price}</td>


                        </tr>
                    </c:forEach>

                </c:forEach>

            </table>
            <div class="pager">

            </div>
        </div>
    </div>
    <div class="clear">

    </div>
</div>

<div id="footer">
    安徽大学江淮学院 2019级 计算机科学与技术专业 陶龙宇 学号JB194033
</div>

<style type="text/css">
    .mytr{
        font-size: 18px;
        font-family: "楷体";
        font-weight: bold;
        background: #f7f4eb;
    }
</style>

<script type="text/javascript">
    $(function () {
        $("#subsearch").click(function () {

            $("#pageIndex").val(1);
            $("#myform").submit();

        })

        $(".mymanageDel").click(function () {
            if(confirm("你确定要删除吗")){
                var id = $(this).attr("rel");
                $.post("${ctx}/order/delorder/"+id,function (result){
                    alert(result.msg);
                    if (result.code==10000){
                        location.href="${ctx}/order/getorders"
                    }
                },"json")
            }
            })


 })

</script>

</body>
</html>
